/*
 * @Description: 编辑弹窗配置（包含新增编辑）
 * @Author: HuiSir<https://gitee.com/huisir001>
 * @Date: 2021-11-05 11:41:30
 * @LastEditTime: 2025-10-09 10:36:05
 */
import { defineFormOptions } from "@/components/TablePage/predefined";
import { SexOpt } from "@/helpers/selection";
import { REG_EXP_PATTERN } from "@/ui";

export default defineFormOptions(() => [
  {
    label: "账号",
    component: "input",
    key: "accountNo",
    props: {
      placeholder: "请输入账号",
    },
    rules: {
      required: true,
    },
  },
  {
    label: "密码",
    component: "input",
    key: "password",
    props: {
      placeholder: "请输入密码",
      type: "password",
      autocomplete: "new-password",
    },
    rules: {
      required: true,
    },
  },
  {
    label: "部门",
    key: "deptId",
    slot: "editDeptId",
    default: null,
  },
  {
    label: "角色",
    key: "roleIds",
    slot: "editRole",
    rules: {
      required: true,
    },
  },
  {
    label: "名字",
    component: "input",
    key: "name",
    props: {
      placeholder: "请输入昵称",
    },
  },
  {
    label: "手机",
    component: "input",
    key: "phone",
    props: {
      placeholder: "请输入手机号码",
    },
    rules: {
      trigger: "blur",
      pattern: REG_EXP_PATTERN.mobile,
      message: "手机号填写错误",
    },
  },
  {
    label: "性别",
    component: "radio",
    key: "sex",
    options: SexOpt.options,
  },
  {
    label: "状态",
    component: "switch",
    key: "status",
    props: {
      activeText: "正常",
      inactiveText: "冻结",
      activeValue: 1,
      inactiveValue: 0,
    },
  },
]);
